﻿using System;
using System.Drawing;
using System.Windows.Forms;
using xfsale.lib;

namespace xfsale.ui
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            try
            {
                xfsale.lib.App.Init();

                //DevExpress.UserSkins.BonusSkins.Register();
                DevExpress.UserSkins.OfficeSkins.Register();
                DevExpress.Skins.SkinManager.EnableFormSkins();
                Application.ThreadException += ErrorHandler;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                
                App.Op.RegionCode = "0001";
                App.Op.BranchCode = "0001001";
                App.Op.NetCode = "0001001";
                App.Op.OpCode = "00000002";
                App.Op.OpName = "叶卫国";
                App.Sys.Status = "1";
                App.Sys.Version = "0.0.1";
                App.Sys.WorkDay = DateTime.Now.ToString("yyyyMMdd");
                Application.Run(new WinMain());

                /*WinLogin login = new WinLogin();
                if (login.ShowDialog() == DialogResult.OK)
                {
                    Application.Run(new WinMain());
                }*/
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                Application.Exit();
            }
            finally
            {
                xfsale.lib.App.Dispose();
            }
        }

        static void ErrorHandler(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            MessageBox.Show(e.Exception.Message);
            Application.Exit();
        }
    }
}
